const showTitle = {
    inserted(el, binding) {
        elBind(el, binding.value)
    },
    componentUpdated(el, binding) {
        elBind(el, binding.value)
    }
}

function elBind(el, value) {
    // 设置超出隐藏
    el.style.overflow = "hidden";
    el.style.textOverflow = "ellipsis";
    el.style.whiteSpace = "nowrap";
    // 鼠标移入提示title
    if (el.clientWidth < el.scrollWidth) {
        el.title = value || el.innerHTML;
    } else {
        el.title = value || ''
    }
}
export default showTitle